package com.itzmn.thread.synchronizedtest;

import java.util.ArrayList;

/**
 * @Author: 张梦楠
 * @Date: 2018/12/27 14:53
 * 简书：https://www.jianshu.com/u/d611be10d1a6
 * 码云：https://gitee.com/zhangqiye
 * @Description:
 */
public class Father {


    static class m{

       static final Father father =  new Father();
    }
    static Father get(){

        return  m.father;
    }


    public synchronized void say(){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("Nihao");
    }

    public synchronized void eat(){
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("eat");
    }

}
